﻿using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;

namespace HDS.Common.Helper
{
    public static class EncryptHelper
    {
        public const string passwordMixKey = "hds_00_*#";

        public static string CreatePassword(this string password)
        { 
            return CreateMD5(CreateMD5(password) + passwordMixKey);
        }

        public static string CreateMD5(this string source)
        {
            if (source == null)
                source = "";

            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(source)));
            t2 = t2.Replace("-", "");
            t2 = t2.ToUpper();
            return t2;
        }
    }
}
